﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace TEL.TelPhoneF.Controls
{
    public partial class ButtonOption : Button
    {
        public ButtonOption()
        {
            InitializeComponent();
           SetStyle(ControlStyles.Selectable , false);
            this.Paint += new PaintEventHandler(ButtonOption_Paint);

        }

        protected void ButtonOption_Paint(object sender, PaintEventArgs e)
        {
            Paths paths = new Paths();
            GraphicsPath gp = null;

            switch (Fairing)
            {
                case FairingOrientation.FairingLeft:
                    gp = paths.FairingLeftPath(new Point(1, 1), this.Size - new Size(2, 2));
                    break;
                case FairingOrientation.FairingRight:
                    gp = paths.FairingRightPath(new Point(1, 1), this.Size - new Size(2, 2));
                    break;
                case FairingOrientation.Fairing:
                    gp = paths.FairingPath(new Point(1, 1), this.Size - new Size(2, 2));
                   // gp = paths.FairingPath(new Point(0, 0), this.Size - new Size(1, 1));
                    break;
            }
            if (gp != null) e.Graphics.DrawPath(new Pen(ColorView), gp);
        }

        public ButtonOption(IContainer container)
        {
            container.Add(this);

            InitializeComponent();
            this.Paint += new PaintEventHandler(ButtonOption_Paint);
        }

        public Color ColorView { get; set; }

        public FairingOrientation Fairing { get; set; }
    }

    public enum FairingOrientation
    {
        None,
        Fairing,
        FairingLeft,
        FairingRight
    }
}
